package com.xmlt.core.template.types;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public final class ValidatorRegistry {
	private static Map<String, IValidator> validators = new HashMap<String, IValidator>() {
		{
			put("string", new StringValidator());
			put("integer", new IntegerValidator());
			put("real", new RealValidator());
			put("boolean", new BooleanValidator());
		}
	};

	public static IValidator getValidator(String id) {
		return validators.get(id);
	}
	
	public static void addValidatorFactory(String id, IValidatorFactory factory) {
		validators.put(id, factory.getValidatorInstance());
	}
	
	public static List<String> getValidatorIds() {
		List<String> ids = new ArrayList<String>();
		for (String id : validators.keySet()) {
			ids.add(id);
		}
		return ids;
	}

}
